package com.ruoyi.merchant.controller;


import com.ruoyi.common.core.cg.result.Result;
import com.ruoyi.merchant.service.MineService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RequestMapping("mine")
@RestController
public class MineController {


    @Autowired
    private MineService mineService;

    //   团长 拼团 数据
    @RequestMapping("getMenberReport")
    public Result getMenberReport() {
        try {
            Map<String, List> data = mineService.getMenberReport();
            return new Result(true, "获取拼团数量报表成功", data);
        } catch (Exception e) {
            e.printStackTrace();
            return new Result(false, "获取拼团数量报表失败");
        }
    }


    // 销售额
    @RequestMapping("getSalesReport")
    public Result getSalesReport(Integer lid) {
        try {
            Map<String, List> data = mineService.getSalesReport(lid);
            return new Result(true, "获取销售额报表成功", data);
        } catch (Exception e) {
            e.printStackTrace();
            return new Result(false, "获取销售额报表失败");
        }
    }

    // 获取客户数量
    @RequestMapping("getCustomerReport")
    public Result getCustomerReport(Integer lid) {
        try {
            Map<String, List> data = mineService.getCustomerReport(lid);
            return new Result(true,"获取客户数量报表成功",data);
        } catch (Exception e) {
            e.printStackTrace();
            return new Result(false, "获取客户数量报表失败");
        }
    }


}
